extends Node2D

var _pressed = false

# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.

func setPressed(v : bool):
	get_node("gray").visible = !v
	get_node("light").visible = v
	pass
	
func isPressed():
	return get_node("light").visible

func _on_button_down():
	_pressed = isPressed()
	if _pressed:
		return
	setPressed(true)
	pass # Replace with function body.


func _on_button_gui_input(event):
	if _pressed:
		return
	if isPressed() && event is InputEventMouseMotion:
		var pos = event.position
		var size = get_node("button").rect_size
		if pos.x < 0 || pos.x > size.x || pos.y < 0 || pos.y > size.y:
			setPressed(false)
		pass
	pass # Replace with function body.
